package ink.teamwork.battery.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class TemplateExpressionUtils {

    private static final String pattern = "^#\\{(.*)}$";
    private static final String EXPRESSION_CENTER = "center";
    private static final String EXPRESSION_COUNTRY = "country";


    public static boolean isExpression(String content) {
        return Pattern.matches(pattern, content);
    }

    public static boolean isCenter(String content) {
        Pattern pattern1 = Pattern.compile(pattern);
        Matcher m = pattern1.matcher(content);
        return m.find() && EXPRESSION_CENTER.equals(m.group(1));
    }

    public static boolean isCountry(String content) {
        Pattern pattern1 = Pattern.compile(pattern);
        Matcher m = pattern1.matcher(content);
        return m.find() && EXPRESSION_COUNTRY.equals(m.group(1));
    }
}
